package cn.doitedu

object GenericTestScala {

  def main(args: Array[String]): Unit = {

    def up[T <:Middle](t:T):T = {t}

    def down[T >:Middle](t:T):T = {t}

    //up(High())
    val middle: Middle = up(new Middle())
    val l1: Middle = up[Middle](new Low())
    val l2: Low = up(new Low())
    //val l3 = up[High](new High())

    //down[High](new Tall())
    down[Tall](new High())
    down[Middle](new Middle())
    val l: Middle = down[Middle](new Low())
  }
}

class Tall()
class High() extends Tall
class Middle() extends High
class Low() extends Middle
